using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;

namespace OA.BLL
{
    public class Performance:Base
    {
       
        private DAL.Performance dal = null;

        public Performance()
        {
            isession = DB_help.NHibernateHelper.GetCurrentSession(DefaultDataBase);
            dal=new DAL.Performance(isession);
        }


        public Common.Result Add(Model.Performance value)
        {
            var ret = dal.Add(value);
            return ret;
        }

        public Common.Result Update(Model.Performance value)
        {
            Common.Result ret = new Common.Result(false, 0, "修改失败");
            var dalvalue = dal.GetModel(value.ID);
            if (dalvalue == null)
            {
                ret.success = false;
                ret.count = 0;
                ret.message = "数据不存在";
                return ret;
            }
            ret=dal.Update(dalvalue);
            return ret;
        }

        public Common.Result Delete(string ids)
        {

            var ret=dal.Delete(ids);
            return ret;
        }

        public Model.Performance Get(int  id)
        {
            return dal.GetModel(id);
        }

        public IList<Model.Performance> Get(string where, string orderby, int start, int length, params object[] ps)
        {
            return dal.Get(where, orderby, start, length, ps);
        }

        public int GetCount(string where, params object[] ps)
        {
            return dal.GetCount(where, ps);
        }
    }
}
